﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using HumanManagement.BusinessObjects;
using HumanManagement.DataAccess;

namespace HumanManagement.BusinessLogic
{
	public class ContactPhoneCategoryBL
	{

		#region ***** Init Methods ***** 
		ContactPhoneCategoryDA objContactPhoneCategoryDA;
		public ContactPhoneCategoryBL()
		{
			objContactPhoneCategoryDA = new ContactPhoneCategoryDA();
		}
		#endregion

		#region ***** Get Methods ***** 
		/// <summary>
		/// Get ContactPhoneCategory by id
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns>ContactPhoneCategory</returns>
		public ContactPhoneCategory GetByID(int id)
		{
			return objContactPhoneCategoryDA.GetByID(id);
		}

		/// <summary>
		/// Get all of ContactPhoneCategory
		/// </summary>
		/// <returns>List<<ContactPhoneCategory>></returns>
		public List<ContactPhoneCategory> GetList()
		{
			string cacheName = "lstContactPhoneCategory";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objContactPhoneCategoryDA.GetList(), "ContactPhoneCategory");
			}
			return (List<ContactPhoneCategory>) ServerCache.Get(cacheName);
		}

		/// <summary>
		/// Get DataSet of ContactPhoneCategory
		/// </summary>
		/// <returns>DataSet</returns>
		public DataSet GetDataSet()
		{
			string cacheName = "dsContactPhoneCategory";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objContactPhoneCategoryDA.GetDataSet(), "ContactPhoneCategory");
			}
			return (DataSet) ServerCache.Get(cacheName);
		}


		/// <summary>
		/// Get all of ContactPhoneCategory paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>List<<ContactPhoneCategory>></returns>
		public List<ContactPhoneCategory> GetListPaged(int recperpage, int pageindex)
		{
			return objContactPhoneCategoryDA.GetListPaged(recperpage, pageindex);
		}

		/// <summary>
		/// Get DataSet of ContactPhoneCategory paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>DataSet</returns>
		public DataSet GetDataSetPaged(int recperpage, int pageindex)
		{
			return objContactPhoneCategoryDA.GetDataSetPaged(recperpage, pageindex);
		}





		#endregion

		#region ***** Add Update Delete Methods ***** 
		/// <summary>
		/// Add a new ContactPhoneCategory within ContactPhoneCategory database table
		/// </summary>
		/// <param name="obj_contactphonecategory">ContactPhoneCategory</param>
		/// <returns>key of table</returns>
		public int Add(ContactPhoneCategory obj_contactphonecategory)
		{
			ServerCache.Remove("ContactPhoneCategory", true);
			return objContactPhoneCategoryDA.Add(obj_contactphonecategory);
		}

		/// <summary>
		/// updates the specified ContactPhoneCategory
		/// </summary>
		/// <param name="obj_contactphonecategory">ContactPhoneCategory</param>
		/// <returns></returns>
		public void Update(ContactPhoneCategory obj_contactphonecategory)
		{
			ServerCache.Remove("ContactPhoneCategory", true);
			objContactPhoneCategoryDA.Update(obj_contactphonecategory);
		}

		/// <summary>
		/// Delete the specified ContactPhoneCategory
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns></returns>
		public void Delete(int id)
		{
			ServerCache.Remove("ContactPhoneCategory", true);
			objContactPhoneCategoryDA.Delete(id);
		}
		#endregion
	}
}
